package com.wq.ui;

import com.wq.ui.coms.BasicArtButton;
import com.wq.ui.coms.BasicMenuPane;
import com.wq.ui.coms.ImageGet;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

@Data
@RequiredArgsConstructor(onConstructor_ = {@Autowired})
@Component
public class StartPanel extends BasicMenuPane {

    private final MainPanel mainPanel;

    private final GamePanel gamePanel;

    @PostConstruct
    public void init(){
        render(2, false);
//        setButtonLink(1, mainPanel);
        setBounds(0, 0, 1000, 800);
        setButtonLink(0, gamePanel);
        setButtonLink(1, mainPanel);
        addButtonListener(0, new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
//                Manager.getManager().start(num);
            }
        });

        init(100, 50, 150, false);
        transform(0, 200);
        setNames(new String[]{"确认", "返回"});
        setBackImage(ImageGet.getImageGet().getSetNum());
        BasicArtButton two = new BasicArtButton("Two");
        two.setBounds(300, 300, 100, 50);
        add(two);
        BasicArtButton three = new BasicArtButton("Three");
        three.setBounds(450, 300, 100, 50);
        add(three);
        BasicArtButton four = new BasicArtButton("Four");
        four.setBounds(600, 300, 100, 50);
        add(four);
        two.addButtonListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
//                num = 2;
            }
        });
        three.addButtonListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
//                num = 3;
            }
        });
        four.addButtonListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
//                num = 4;
            }
        });
    }
}
